package com.ea.eadp.nexus.test.pageDefinition.newconsole;

import com.ea.eadp.nexus.test.common.TestUtil;
import org.openqa.selenium.WebDriver;
import org.testng.Assert;


public class ErrorMessagePage extends ConsoleBasePage {
    public static final String errorMessageLabel = "modal";

    public ErrorMessagePage(WebDriver driver) {
        super(driver, ErrorMessagePage.class, errorMessageLabel);
    }

    public void close() {
        log.info("Close Error Message Page");
        sendControllerKey('A');
    }

    public void validateErrorMessage(String errorMessage) {
        log.info("Validate Error Message:" + errorMessage);
        TestUtil.sleep(1);
        Assert.assertEquals(getErrorMessage(), errorMessage, "Input not trigger the correct error message");
    }

    public String getErrorMessage() {
        return getElementStringByXPath("//div[@id='modal']//p[@class='description']");
    }
}